//package com.goose.bmm.controler.activity;
//
//import android.app.AlertDialog;
//import android.content.Context;
//import android.content.DialogInterface;
//import android.content.Intent;
//import android.os.Bundle;
//import android.os.Vibrator;
//import android.support.v7.app.ActionBarActivity;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.view.WindowManager;
//import android.widget.AdapterView;
//import android.widget.AdapterView.OnItemLongClickListener;
//import android.widget.Button;
//import android.widget.EditText;
//import android.widget.ListView;
//
//import com.goose.bmm.R;
//import com.goose.bmm.controler.adapter.ListPlayerAdapter;
//import com.goose.bmm.controler.dialog.PlayerDialog;
//import com.goose.bmm.model.business.Constants;
//import com.goose.bmm.model.business.DataGlobal;
//
//public class SettingHomeTeamActivity extends ActionBarActivity implements
//		OnClickListener, OnItemLongClickListener {
//
//	private Button mButtonNext;
//	private Button mButtonAddPlayer;
//	private EditText mEditTextTeamName;
//	private EditText mEditTextCoachName;
//	private ListView mListViewPlayers;
//
//	private ListPlayerAdapter mListPlayerAdapter;
//
//	@Override
//	protected void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		getSupportActionBar().hide();
//		getWindow().setSoftInputMode(
//				WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
//		setContentView(R.layout.activity_setting_team_home);
//
////		mButtonNext = (Button) findViewById(R.id.btn_next_setting_home);
//		mButtonAddPlayer = (Button) findViewById(R.id.btn_add_player_home);
//		mEditTextTeamName = (EditText) findViewById(R.id.edt_team_name_home);
//		mEditTextCoachName = (EditText) findViewById(R.id.edt_coach_home);
//		mListViewPlayers = (ListView) findViewById(R.id.lv_player_home);
//
//		mButtonNext.setOnClickListener(this);
//		mButtonAddPlayer.setOnClickListener(this);
//
//		mListPlayerAdapter = new ListPlayerAdapter(this,
//				DataGlobal.homeListPlayer);
//		mListViewPlayers.setAdapter(mListPlayerAdapter);
//		mListViewPlayers.setOnItemLongClickListener(this);
//	}
//
//	@Override
//	public void onClick(View v) {
////		if (v.getId() == R.id.btn_next_setting_home) {
////			if (mEditTextTeamName.getText().toString().isEmpty()) {
////				new AlertDialog.Builder(this)
////						.setMessage(
////								getResources()
////										.getString(
////												R.string.dialog_massage_enter_team_name))
////						.setPositiveButton(
////								getResources().getString(R.string.ok), null)
////						.show();
////				return;
////			}
////			if (mListViewPlayers.getAdapter().getCount() < 5) {
////				new AlertDialog.Builder(this)
////						.setMessage(
////								getResources()
////										.getString(
////												R.string.dialog_massage_nb_player_than_more_5))
////						.setPositiveButton(
////								getResources().getString(R.string.ok), null)
////						.show();
////				return;
////			}
////
////			if (mListPlayerAdapter.getCounterFisrtTeam() < 5) {
////				new AlertDialog.Builder(this)
////						.setMessage(
////								getResources()
////										.getString(
////												R.string.dialog_massage_enough_5_player))
////						.setPositiveButton(
////								getResources().getString(R.string.ok), null)
////						.show();
////				return;
////			}
//
//			// setup home team info
////			DataGlobal.homeTeamGlobal.setTeamName(mEditTextTeamName.getText()
////					.toString());
////			DataGlobal.homeTeamGlobal.setHeadCoach(mEditTextCoachName.getText()
////					.toString());
////
////			Intent intentSettingGuestActivity = new Intent(
////					SettingHomeTeamActivity.this,
////					SettingGuestTeamActivity.class);
////			startActivity(intentSettingGuestActivity);
////			finish();
////			return;
////		}
////		if (v.getId() == R.id.btn_add_player_home) {
////
////			PlayerDialog addPlayerDialog = new PlayerDialog(
////					SettingHomeTeamActivity.this, null, this,
////					Constants.ADD_PLAYER_DIALOG);
////			addPlayerDialog.show();
////		}
////	}
//
//	public void refresfListView() {
//		mListViewPlayers.invalidateViews();
//	}
//
//	@Override
//	public boolean onItemLongClick(AdapterView<?> arg0, View view,
//			final int position, long arg3) {
//		Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
//		vibrator.vibrate(500);
//		new AlertDialog.Builder(this)
//				.setMessage(
//						getResources().getString(
//								R.string.dialog_massage_what_do_you_want))
//				.setPositiveButton(getResources().getString(R.string.edit),
//						new DialogInterface.OnClickListener() {
//
//							@Override
//							public void onClick(DialogInterface dialog,
//									int which) {
//								dialog.cancel();
//								dialog.dismiss();
//								showEditPlayerDialog(position);
//							}
//						})
//				.setNegativeButton(getResources().getString(R.string.cancel),
//						null)
//				.setNeutralButton(getResources().getString(R.string.delete),
//						new DialogInterface.OnClickListener() {
//
//							@Override
//							public void onClick(DialogInterface dialog,
//									int which) {
//								showDeletePlayerDialog(position);
//							}
//						}).show();
//		return true;
//	}
//
////	private void showEditPlayerDialog(int position) {
////		PlayerDialog editPlayerDialog = new PlayerDialog(
////				SettingHomeTeamActivity.this, null, this,
////				Constants.EDIT_PLAYER_DIALOG);
////		editPlayerDialog.setupInfo(position);
////		editPlayerDialog.show();
////	}
//
//	private void showDeletePlayerDialog(final int position) {
//		new AlertDialog.Builder(this)
//				.setMessage(
//						getResources().getString(
//								R.string.dialog_massage_are_you_want_delete)
//								+ " " + (position + 1) + " ?")
//				.setPositiveButton(getResources().getString(R.string.ok),
//						new DialogInterface.OnClickListener() {
//
//							@Override
//							public void onClick(DialogInterface dialog,
//									int which) {
//								DataGlobal.homeListPlayer.remove(position);
//								refresfListView();
//							}
//						})
//				.setNegativeButton(getResources().getString(R.string.no), null)
//				.show();
//	}
//}
